#ifndef RISKMEASURETABLEMODEL_H
#define RISKMEASURETABLEMODEL_H

#include <QAbstractTableModel>
#include <boost/shared_ptr.hpp>
#include "riskmeasure/RiskMeasure.h"
#include <vector>

class RiskMeasureTableModel : public QAbstractTableModel
{
public:
    void setRiskMeasure(boost::shared_ptr<quic::RiskMeasure> riskMeasure);
    boost::shared_ptr<quic::RiskMeasure> getRiskMeasure(unsigned int index);

    int rowCount(const QModelIndex &) const {
        return numRows;
    }
    inline int columnCount(const QModelIndex &) const { return 3; }
    QVariant data(const QModelIndex &index, int role) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    //Qt::ItemFlags flags(const QModelIndex &index) const;
    bool setData(const QModelIndex &index, const QVariant &value, int role);
private:
    boost::shared_ptr<quic::RiskMeasure> riskMeasure;
    std::vector<boost::shared_ptr<quic::RiskMeasure> > riskMeasureIndex;
    void indexRiskMeasure(boost::shared_ptr<quic::RiskMeasure> riskMeasure,
                         std::map<std::string,bool> &nameMap);
    unsigned int numRows;
};

#endif // RISKMEASURETABLEMODEL_H
